package com.kfm.pm;

public class Demo01 {

    // 计算 1 - n 的和
    public static int sum(int n) {
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum +=i;
        }
        return sum;
    }

    // 判断一个整数是 奇数 还是偶数
    public static String isOdd(int number) {
//        if (number % 2 == 0) {
//            return "偶数";
//        } else {
//            return "奇数";
//        }
        return number % 2 == 0 ? "偶数" : "奇数";
    }

    public static void main(String[] args) {
        System.out.println(sum(100));

        System.out.println(isOdd(2));
    }


}
